package common;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;

/**
 * 
 * Custom wait
 * http://www.thoughtworks-studios.com/docs/twist/2.3/help/how_do_i_handle_ajax_in_selenium2.html
 * 
 */

public class VisibilityOfElement {

	 public ExpectedCondition<WebElement> visibilityOfElementLocated(final By by) {
	        return new ExpectedCondition<WebElement>() {
	          public WebElement apply(WebDriver driver) {
	            WebElement element = driver.findElement(by);
	            return element.isDisplayed() ? element : null;
	          }
	        };
	      }
}
